#include <string.h>
#include <fcntl.h>
#include <io.h>
#include <string.h>

#include "tools.h"

void Ctools_Onefish::file_change (const char * filename, const char * expand_name
				 , char *change_name)
{
    char  * change_backup;
    short on=1;

    change_backup=change_name;
    while (*filename!=0x2e&&*filename!=' ')
    {
		*change_backup=*filename;
		change_backup++;
		filename++;
    }
    *change_backup++='.';
    *change_backup++=0;
    *change_backup++=0;
    *change_backup++=0;
    strcat (change_name,expand_name);
}

int  Ctools_Onefish::file_length (const char *filename)
{
	int handle;
	handle=open (filename,O_RDONLY|O_BINARY);

    if (handle==-1)
		return (-1);
    close ( handle );
	return (filelength (handle));
}